package com.myworkspace.standard.common.config;

import com.myworkspace.standard.common.utils.CustomUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 上传的路径
 */
@Component
@ConfigurationProperties(prefix = "liyang.upload")
public class UploadConfig {
    private String macPath;
    private String linuxPath;

    public String getMacPath() {
        return macPath;
    }

    public void setMacPath(String macPath) {
        this.macPath = macPath;
    }

    public String getLinuxPath() {
        return linuxPath;
    }

    public void setLinuxPath(String linuxPath) {
        this.linuxPath = linuxPath;
    }

    public String getUploadPath() {
        String osName = CustomUtils.getOsName();
        if ("mac".equals(osName)) {
            return this.macPath;
        } else if ("linux".equals(osName)) {
            return this.linuxPath;
        }
        return "";
    }
}
